<?php
session_start();
require '../nette/Nette/loader.php';
require '../db.php';
require '../localization/lang.php';
require '../core/core.sanitizer.php';
require '../core/core.security.php';
require '../core/core.dfs.php';
require '../visual/visual.dfs.php';
require '../core/core.time.php';

$login=new core_security;
if ($login->checklogin()=="OK" AND $_SESSION['role']<=2) {
$loc=new loc;

if ($_SESSION['role'] < 1 ) {
$users="";
$query="select * from users";
$result=mysql_query($query);
echo "<table>";
echo "<tr><td class='userstats'><b>".$loc->name."</b></td><td class='userstats'><b>login</b></td><td class='userstats'><b>role</b></td><td class='userstats'><b>enable/disable</b></td><td class='userstats'><b>user jobs</b></td><td class='userstats'><b>change passwd</b></td></tr>";
while ($row=mysql_fetch_array($result)) {
	if ($row['role']==0){$rl="admin";}
	if ($row['role']==1){$rl="account";}
	if ($row['role']==2){$rl="user";}
	if ($row['role']==3){$rl="part-time";}
	if ($row['disabled'] == "0") {$disableenable="disable";$class="red";$show="userrow";}else{$disableenable="enable";$class="green";$show="disableduser";}
	echo "<tr class='".$show."'><td class='userstats'><span class='editusername' id='".$row['id']."'>".$row['name']."</span></td><td class='userstats'><span class='edituserlogin' id='".$row['id']."'>".$row['login']."</span></td><td class='userstats'><span class='edituserrole' id='".$row['id']."'>".$rl."</span></td><td class='userstats'><span class='".$class."'><span id='".$row['id']."' onClick='enabledisableuser(\"".$row['id']."\",\"".$disableenable."\")'>".$disableenable."</span></span></td><td class='userstats'><span class='editnodes' onClick='editnodes(\"".$row['login']."\");'>edit</span></td><td class='userstats'><span class='blue'><span class='changepasswd' id='".$row['id']."'></span></span></td></tr>";
	}
echo "</table>";



}
}
?>
